<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();
import zhCn from "element-plus/es/locale/lang/zh-cn";
import en from "element-plus/es/locale/lang/en";
import { ref } from "vue";
const locale = ref(zhCn);
import { useI18n } from "vue-i18n";
const { locale: locale2 } = useI18n();
const changeLanguage = (language: any) => {
  console.log(language)
  locale.value = language;
  locale2.value = language.name;
};
</script>

<template>
  <el-config-provider :locale="locale">
    <div>
      <el-button @click="changeLanguage(zhCn)">中文</el-button>
      <el-button @click="changeLanguage(en)">英文</el-button>
      <el-date-picker type="date" placeholder="Pick a day" />
      <button class="mr10" @click="() => router.push({ path: '/home' })">
        首页
      </button>
      <button @click="() => router.push({ path: '/mine' })">个人中心</button>
    </div>
    <div>
      <router-link class="mr10" to="/home">首页</router-link>
      <router-link class="mr10" to="/mine">个人中心</router-link>
      <router-link to="/helloWorld/xx">HelloWorld</router-link>
    </div>
    <router-view />
  </el-config-provider>
</template>

<style scoped lang="scss">
.mr10 {
  margin-right: 10px;
}
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
button {
  font-size: 40px;
}
</style>
